@namespace Oqtane.Themes.Controls
@inherits LoginBase
@inject IStringLocalizer<Login> Localizer
@inject IStringLocalizer<SharedResources> SharedLocalizer

@if (PageState.User != null)
{
    @if (PageState.Runtime == Runtime.Hybrid)
    {
        <button type="button" class="@CssClass app-login" @onclick="LogoutUser">@Localizer["Logout"]</button>
    }
    else
    {
        <form method="post" class="app-form-inline app-login" action="@logouturl" @formname="LogoutForm">
            <input type="hidden" name="@Constants.RequestVerificationToken" value="@SiteState.AntiForgeryToken" />
            <input type="hidden" name="returnurl" value="@returnurl" />
            <input type="hidden" name="everywhere" value="@everywhere" />
            <button type="submit" class="@CssClass">@Localizer["Logout"]</button>
        </form>
    }
}
else
{
    @if (ShowLogin)
    {
        <a href="@loginurl" class="@CssClass app-login">@SharedLocalizer["Login"]</a>
    }
}

@code
{
    [Parameter]
    public bool ShowLogin { get; set; } = true;
    [Parameter]
    public string CssClass { get; set; } = "btn btn-primary";
}